﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace NJL.WebManage.SystemNotice
{
    public partial class EditSystemNotice :BasePage
    {
        NJL.BLL.NJL_SYS_ANNOUNCEMENT bll = new BLL.NJL_SYS_ANNOUNCEMENT();
        NJL.Model.NJL_SYS_ANNOUNCEMENT model;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                bind();
            }

        }
        void bind()
        {
            model = bll.GetModel(Request.QueryString["id"].ToString());
            txtTitle.Text = model.ANNOUNCEMENT_NAME;
            txtContent.Text = model.ANNOUNCEMENT_CONTENT;
            txtSort.Text = model.SORT.ToString();
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            model = bll.GetModel(Request.QueryString["id"].ToString());
            model.ANNOUNCEMENT_NAME = txtTitle.Text.Trim();
            model.ANNOUNCEMENT_CONTENT = txtContent.Text.Trim();
            model.UPDATE_DATE_TIME = DateTime.Now;
            model.UPDATE_USER_ID = USER_ID;
            model.UPDATE_USER_NAME = USER_NAME;
            model.SORT = int.Parse(txtSort.Text.Trim());
            if (bll.Update(model))
            {
                Royalsoft.Common.MessageBox.ShowAndRedirect(this, "更新成功", Request.Url.ToString());
            }
        }
    }
}